From: Juergen Gross Date: Wed, 23 Aug 2017 17:34:00 +0000 (+0200) Subject: xen/common/efi/boot.c: let custom parameter parsing routines return errno X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~1581 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=7f0d1e91d387f93424120c263e56b85047acb06d;p=xen.git xen/common/efi/boot.c: let custom parameter parsing routines return errno Modify the custom parameter parsing routines in: xen/common/efi/boot.c to indicate whether the parameter value was parsed successfully. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 11bdc7a2a4..01d33004e0 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -1306,9 +1306,10 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) static bool __initdata efi_map_uc; -static void __init parse_efi_param(char *s) +static int __init parse_efi_param(const char *s) { - char *ss; + const char *ss; + int rc = 0; do { bool val = strncmp(s, "no-", 3); @@ -1317,21 +1318,25 @@ static void __init parse_efi_param(char *s) s += 3; ss = strchr(s, ','); - if ( ss ) - *ss = '\0'; + if ( !ss ) + ss = strchr(s, '\0'); - if ( !strcmp(s, "rs") ) + if ( !strncmp(s, "rs", ss - s) ) { if ( val ) __set_bit(EFI_RS, &efi_flags); else __clear_bit(EFI_RS, &efi_flags); } - else if ( !strcmp(s, "attr=uc") ) + else if ( !strncmp(s, "attr=uc", ss - s) ) efi_map_uc = val; + else + rc = -EINVAL; s = ss + 1; - } while ( ss ); + } while ( *ss ); + + return rc; } custom_param("efi", parse_efi_param);